package com.neusoft.resturant.service.impl;


import com.neusoft.resturant.entity.ResUsers;
import com.neusoft.resturant.mapper.ResUsersMapper;
import com.neusoft.resturant.service.IResUsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 用户Service业务层处理
 * 
 * @author zhengzijia0934
 * @date 2023-12-20
 */
@Service
public class ResUsersServiceImpl implements IResUsersService
{
    @Autowired
    private ResUsersMapper resUsersMapper;

    /**
     * 查询用户
     * 
     * @param id 用户主键
     * @return 用户
     */
    @Override
    public ResUsers selectResUsersById(Long id)
    {
        return resUsersMapper.selectResUsersById(id);
    }

    /**
     * 查询用户列表
     * 
     * @param resUsers 用户
     * @return 用户
     */
    @Override
    public List<ResUsers> selectResUsersList(ResUsers resUsers)
    {
        return resUsersMapper.selectResUsersList(resUsers);
    }

    /**
     * 新增用户
     * 
     * @param resUsers 用户
     * @return 结果
     */
    @Override
    public int insertResUsers(ResUsers resUsers)
    {
        resUsers.setCreateTime(new Date());
        return resUsersMapper.insertResUsers(resUsers);
    }

    /**
     * 修改用户
     * 
     * @param resUsers 用户
     * @return 结果
     */
    @Override
    public int updateResUsers(ResUsers resUsers)
    {
        resUsers.setUpdateTime(new Date());
        return resUsersMapper.updateResUsers(resUsers);
    }

    /**
     * 批量删除用户
     * 
     * @param ids 需要删除的用户主键
     * @return 结果
     */
    @Override
    public int deleteResUsersByIds(Long[] ids)
    {
        return resUsersMapper.deleteResUsersByIds(ids);
    }

    /**
     * 删除用户信息
     * 
     * @param id 用户主键
     * @return 结果
     */
    @Override
    public int deleteResUsersById(Long id)
    {
        return resUsersMapper.deleteResUsersById(id);
    }
}
